//
//  MineSecondCollectionViewCell.m
//  quxiangtao
//
//  Created by xbmios on 2018/7/10.
//  Copyright © 2018年 shanhaijin. All rights reserved.
//

#import "MineSecondCollectionViewCell.h"

@interface MineSecondCollectionViewCell ()

@property (strong, nonatomic) UIImageView *iconIv;
@property (strong, nonatomic) UILabel *nameL;


@end

@implementation MineSecondCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    
    if (self == [super initWithFrame:frame]) {
        
        [self.contentView addSubview:self.iconIv];
        [self.contentView addSubview:self.nameL];
        
    }
    
    return self;
}

- (void)setDict:(NSDictionary *)dict {
    
    _dict = dict;
    
    self.iconIv.image = dict[@"icon"];
    self.nameL.text = dict[@"name"];
    
//    if ([[dict allKeys] containsObject:@"status"]) {
//        
//        self.nameL.textColor = Color999999;
//    }
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    __weak typeof(self) weakSelf = self;
    [self.nameL mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.bottom.mas_equalTo(weakSelf.contentView.mas_bottom).with.offset(-jisuan(10));
    }];
    
    [self.iconIv mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(weakSelf.contentView.mas_top).with.offset(jisuan(10));
        make.centerX.mas_equalTo(weakSelf.contentView.mas_centerX);
        make.width.mas_equalTo(jisuan(40));
        make.height.mas_equalTo(jisuan(40));
    }];
    
}

#pragma mark -lazy
- (UIImageView *)iconIv {
    
    if (!_iconIv) {
        
        _iconIv = [[UIImageView alloc] init];
        _iconIv.contentMode = UIViewContentModeScaleAspectFit;
        
    }
    
    return _iconIv;
}

- (UILabel *)nameL {
    
    if (!_nameL) {
        
        _nameL = [[UILabel alloc] init];
        _nameL.text = @"待支付";
        _nameL.textColor = Color333333;
        _nameL.font = Font(20);
        _nameL.textAlignment = NSTextAlignmentCenter;
        
    }
    
    return _nameL;
    
}

@end
